package fr.doume.jna.jna;

import fr.doume.jna.jna.Sspibis.SecBufferDesc;
import com.sun.jna.platform.win32.Sspi.TimeStamp;
import com.sun.jna.Native;
import com.sun.jna.Pointer;
import com.sun.jna.ptr.PointerByReference;
import com.sun.jna.win32.W32APIOptions;
import com.sun.jna.platform.win32.WinNT;
import com.sun.jna.NativeLong;
import com.sun.jna.Structure;

import fr.doume.jna.jna.Sspibis.CtxtHandle;
import fr.doume.jna.jna.Sspibis.SecHandle;
import fr.doume.jna.jna.Sspibis.CredHandle;
import com.sun.jna.platform.win32.WinNT.LUID;
import com.sun.jna.NativeLong;
import com.sun.jna.ptr.NativeLongByReference;
import com.sun.jna.win32.StdCallLibrary;
import com.sun.jna.platform.win32.WinNT.HANDLEByReference;




public interface Secur32bis extends StdCallLibrary {
	Secur32bis INSTANCE = (Secur32bis) Native.loadLibrary("Secur32",
			Secur32bis.class, W32APIOptions.UNICODE_OPTIONS);
  public int QueryContextAttributes( CtxtHandle phContext, int SECPKG_ATTR, PointerByReference pp);
  public int FreeContextBuffer(Pointer p);
  public int QuerySecurityContextToken(SecHandle phContext, HANDLEByReference phToken);
  
	public int AcquireCredentialsHandle(String pszPrincipal, String pszPackage,
			NativeLong fCredentialUse, LUID pvLogonID,
			Pointer pAuthData, Pointer pGetKeyFn, 
			Pointer pvGetKeyArgument, CredHandle phCredential, 
			TimeStamp ptsExpiry);

	public int AcceptSecurityContext(CredHandle phCredential, CtxtHandle phContext,
			SecBufferDesc pInput, NativeLong fContextReq, NativeLong TargetDataRep,
			CtxtHandle phNewContext, SecBufferDesc pOutput, NativeLongByReference pfContextAttr,
			TimeStamp ptsTimeStamp);

  public int DeleteSecurityContext( CtxtHandle phContext );
  public int FreeCredentialsHandle(CredHandle phCredential);
  
	public static class SecPkgInfoBis extends Structure {
		public NativeLong fCapabilities;  
		public short wVersion;
		public short wRPCID;
		public NativeLong cbMaxToken;
		public Pointer pName;
		public Pointer pComment;
		public SecPkgInfoBis(Pointer p)
		{
      super(p);
		}
	}

}
